/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package upc.jfactory.scp.componente;

import upc.jfactory.scp.entidad.Alumno;

/**
 *
 * @author CESAR
 */
//NO OLVIDEN PONER UN DUMMY POR SI NO FUNCIONAAAA!!!
public class WSAlumnoBC {

    public Alumno GetAlumnoWS(String usuario) {
        Alumno alumno = null;
        try { // Call Web Service Operation
            org.tempuri.ServicePyramid service = new org.tempuri.ServicePyramid();
            org.tempuri.ServicePyramidSoap port = service.getServicePyramidSoap();
            org.tempuri.AlumnoBE result = port.getAlumnoByCodigo(usuario);
            alumno = new Alumno();
            alumno.setNombreAlumno(result.getNombre());
            alumno.setIdAlumno(result.getIdAlumno());
            alumno.setCodigoAlumno(result.getCodigo());
            alumno.setApellidoPaterno(result.getApellidoPaterno());
            alumno.setApellidoMaterno(result.getApellidoMaterno());

        } catch (Exception ex) {
            return alumno;
        }
        return alumno;
    }

    public Alumno GetAlumnoXId(Integer IdAlumno) {
        Alumno alumno = null;
        try { // Call Web Service Operation
            org.tempuri.ServicePyramid service = new org.tempuri.ServicePyramid();
            org.tempuri.ServicePyramidSoap port = service.getServicePyramidSoap();
            org.tempuri.AlumnoBE result = port.getAlumnoByID(IdAlumno);
            alumno = new Alumno();
            alumno.setNombreAlumno(result.getNombre());
            alumno.setIdAlumno(result.getIdAlumno());
            alumno.setCodigoAlumno(result.getCodigo());
            alumno.setApellidoPaterno(result.getApellidoPaterno());
            alumno.setApellidoMaterno(result.getApellidoMaterno());
        } catch (Exception ex) {
            return alumno;
        }
        return alumno;

    }

    public int getEvalCompByIDAlu(int idComp, int idAlu) {
        int eval = 0;
        try { // Call Web Service Operation
            org.tempuri.ServicePyramid service = new org.tempuri.ServicePyramid();
            org.tempuri.ServicePyramidSoap port = service.getServicePyramidSoap();
            // TODO initialize WS operation arguments here
//           int idCompetencia = 0;
//           int idAlu = 0;
            // TODO process result here
            eval = port.getEvalCompByIDAlu(idComp, idAlu);
        } catch (Exception ex) {
            // TODO handle custom exceptions here
            //System.out.println(ex.getMessage());
        }
        return eval;
    }

    public int getEvalCapByIDAlu(int idCap, int idAlu)
    {

        try { // Call Web Service Operation
            org.tempuri.ServicePyramid service = new org.tempuri.ServicePyramid();
            org.tempuri.ServicePyramidSoap port = service.getServicePyramidSoap();
            // TODO initialize WS operation arguments here
//            int idCapacidad = 0;
            //java.lang.String idAlu = "";
            // TODO process result here
            int result = port.getEvalCapByIDAlu(idCap, idAlu);
            //System.out.println("Result = "+result);
        } catch (Exception ex) {
            // TODO handle custom exceptions here
        }

        return 0;
    }
}
